<%@ page language="java" contentType="text/html;charset=UTF-8"
   	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<table cellpadding="0" cellspacing="0" width="690" align="center" border="0"​>
<tr><td colspan="5" height="15"> </td></tr>	
<tr>
<form autocomplete="off" name="frmuser" action="add_group.html" method="post">
			<td colspan="5" height="8" align="left">
			បញ្ចូលឈ្មោះក្រុម:&nbsp;<input type="" id="txtgroup" name="txtgroup">&nbsp;<input type="submit" value="បញ្ចូលថ្មី" class="input_button" name="btngroup">
			<c:if test="${fn:length(error_msg)>0}">
					<br><br><div style="color: red;"><c:out value="${error_msg}"></c:out></div>
			</c:if>
			</td>
</form>		
</tr>
<tr><td colspan="5" height="10"> </td></tr>	
	<tr class="mygroupheader">
		<td width="10%" height="25">លេខរៀង</td>	
		<td width="45%">ឈ្មោះក្រុម</td>	
		<td width="20%">បង្កើតដោយ</td>	
		<td width="10%">សមាជិក</td>	
		<td width="10%">លុបចោល</td>
	</tr>
	<%
		String bgcolor="#EEE";
	%>
	<c:if test="${fn:length(grouplist)>0}">
		<c:forEach var="x" begin="0" end="${fn:length(grouplist)-1}" step="1" varStatus ="status">
			<%
				bgcolor=(bgcolor=="#EEE")?"#FFF":"#EEE";
			%>
				<c:choose>
					<c:when test="${grouplist[x].USER_NAME==curUser}">
						<tr bgcolor="<%=bgcolor%>"​ align="center">
							<td height="40" style="border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;"><c:out value="${x+1}"/></td>
							<td align="center" valign="middle" style="border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;"><span id="divname${x}" style="visibility:hidden; position:absolute; vertical-align: middle; background-color: #ddd;">&nbsp;&nbsp;<input type="text" value="${grouplist[x].GROUP_NAME}" id="txtname${x}">&nbsp;<input type="button" value="រក្សាទុក" class="input_button" onclick="javascript:changeName('${grouplist[x].GROUP_ID}','txtname${x}')">&nbsp;<input type="button" value="បិទ"​ class="input_button" onclick="javascript:closeDiv('divname${x}','divhide${x}','txtname${x}')"></span><span id="divhide${x}"><c:out value="${grouplist[x].GROUP_NAME}"/>&nbsp;&nbsp;<label style="color: #0033FF;text-decoration: underline;font-size: 11px; cursor: pointer;" onclick="javascript:showDiv('divname${x}','divhide${x}','txtname${x}')">កែប្រែ</label></span></td>
							<td style="border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;"><b><c:out value="${grouplist[x].USER_NAME}"/></b></td>
							<td style="border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;"><img src="images/member.png" title="View Members" width="18" height="18" onclick="viewMember(${grouplist[x].GROUP_ID})" style="cursor: pointer;"></td>
							<td style="border:solid 1px #DDD; border-top:solid 0px #DDD;"><img src="images/remove.png" title="Remove" width="18" height="18" onclick="deleteGroup(${grouplist[x].GROUP_ID})" style="cursor: pointer;"></td>
						</tr>
					</c:when>
					<c:otherwise>
						<tr bgcolor="<%=bgcolor%>">
							<td height="40" style="border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;"><c:out value="${x+1}"/></td>
							<td align="center" style="border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;"><c:out value="${grouplist[x].GROUP_NAME}"/></td>
							<td style="border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;"><c:out value="${grouplist[x].USER_NAME}"/></td>
							<td style="border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;"><img src="images/member.png" title="View Members" width="18" height="18" onclick="viewMember(${grouplist[x].GROUP_ID})" style="cursor: pointer;"></td>
							<td style="border:solid 1px #DDD; border-top:solid 0px #DDD; color: #777;"> </td>
						</tr>
					</c:otherwise>
				</c:choose>		
		</c:forEach>
	</c:if>
	<c:if test="${fn:length(grouplist)<=0}">
		<tr>
			<td align="center" colspan="5" height="30" valign="bottom">អ្នកពុំទាន់មានក្រុមនៅឡើយទេ</td>
		</tr>
	</c:if>
</table>
</body>
</html>